package com.oracle.lingshangejia.activity;

import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;

import com.gyf.barlibrary.ImmersionBar;
import com.oracle.lingshangejia.R;
import com.oracle.lingshangejia.base.BaseActivity;

//签约界面
public class SignActivity extends BaseActivity implements View.OnClickListener,RadioGroup.OnCheckedChangeListener {
    private RelativeLayout rl_sign;//签约
    private ImageButton ib_back;
    private RadioGroup sign_radiogroup;
    private RadioButton rb_idcard; //身份证识别
    private RadioButton rb_cartevital;  //医保卡识别
    private int flag=0;  //默认是身份证识别
    @Override
    public int intiLayout() {
        return R.layout.activity_sign;
    }

    @Override
    public void initView() {

        rl_sign=findViewById(R.id.rl_sign);
        sign_radiogroup=findViewById(R.id.sign_radiogroup);
        rb_idcard=findViewById(R.id.rb_idcard);
        rb_cartevital=findViewById(R.id.rb_cartevital);
        ib_back=findViewById(R.id.ib_back);
        ib_back.setOnClickListener(this);
        rl_sign.setOnClickListener(this);
        sign_radiogroup.setOnCheckedChangeListener(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.rl_sign:   //签约
                if(flag==0){
                    startActivity(new Intent(this, IdCardActivity.class));
                }else{  //医保卡识别
                    startActivity(new Intent(this, CarteVitalActivity.class));
                }
                break;
            case R.id.ib_back:
                finish();
                break;
        }
    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        if(checkedId == rb_idcard.getId()){  //选择了身份证识别
            flag=0;
        }else if(checkedId == rb_cartevital.getId()){ //选择了医保卡识别
            flag=1;
        }
    }

}
